‹#›
Inventor API 中的零件图、部件图和工程图
创建草图范例
Dim oCompDef As PartComponentDefinition
oCompDef = _InvApplication.ActiveDocument.ComponentDefinition
Dim oSketch As PlanarSketch
oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))
Dim oTG As TransientGeometry
oTG = _InvApplication.TransientGeometry
Dim oLines(2) As SketchLine
oLines(0)= oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(3, 0))
oLines(1)= oSketch.SketchLines.AddByTwoPoints(oLines(0).EndSketchPoint, oTG.CreatePoint2d(0, 2))
oLines(2)= oSketch.SketchLines.AddByTwoPoints(oLines(1).EndSketchPoint, oLines(0).StartSketchPoint)
Call oSketch.GeometricConstraints.AddHorizontal(oLines(0))
Call oSketch.GeometricConstraints.AddVertical(oLines(2))
Call oSketch.DimensionConstraints.AddTwoPointDistance(oLines(0).StartSketchPoint, _
oLines(0).EndSketchPoint, _
DimensionOrientationEnum.kHorizontalDim, _
oTG.CreatePoint2d(1.5, -0.5))
Call oSketch.DimensionConstraints.AddTwoPointDistance(oLines(2).StartSketchPoint, _
oLines(2).EndSketchPoint, _
DimensionOrientationEnum.kVerticalDim, _
oTG.CreatePoint2d(-0.5, 1))

| Module 04 - Part doc\Samples Module 04 VB.Net